package shm;

import org.apache.tomcat.jni.Library;
import org.apache.tomcat.jni.Stdlib;

/**
 * License: Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
 * <p/>
 * Author: Ashwin Jayaprakash
 * <p/>
 * Email: ashwin.jayaprakash@gmail.com
 * <p/>
 * Web: http://www.ashwinjayaprakash.com
 */
public class AbstractCommon {
    static boolean libraryLoaded;

    static long pid;

    static {
        try {
            Library.initialize(null);
            libraryLoaded = true;

            pid = Stdlib.getpid();

            System.out.println("This is [" + pid + "] with parent [" + Stdlib.getppid() + "]");
        }
        catch (Throwable t) {
            t.printStackTrace();
        }

    }

    public static void sout(String s) {
        System.out.printf("[%d] %s%n", pid, s);
    }
}
